var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(d, c, b) {
    if (status == 0 && d == 0) {
        cm.dispose();
        return
    }
    if (eim.getNumberProperty("core") == 1) {
        cm.playerMessage(-1, "必须破坏掉露出真面目的迷宫之核，离开这里。");
        cm.dispose();
        return
    } else {
        if (eim.getNumberProperty("core") == 2) {
            cm.playerMessage(-1, "已经破坏了迷宫之核，是时候离开这里了。");
            cm.dispose();
            return
        }
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            cm.askMenu("（好像有几根蜡烛灭掉了。要点亮蜡烛吗？）\r\n\r\n#L0#点亮蜡烛。#l\r\n#L2#现在什么都不做。#l", 24, 0)
        } else {
            if (status === a++) {
                if (b == 0) {
                    eim.setProperty("core", 1);
                    cm.lightUpCandle(1, 56228, 0, 1, 10);
                    cm.onSetBackEffect("cube", 1, 0, 0, 0);
                    cm.playerMessage(-1, "必须破坏掉露出真面目的迷宫之核，离开这里。");
                    if (cm.getMapId() == 940300000) {
                        mobid = 8644765
                    } else {
                        if (cm.getMapId() == 940400000) {
                            mobid = 8644766
                        } else {
                            if (cm.getMapId() == 940500000) {
                                mobid = 8644767
                            }
                        }
                    }
                    cm.spawnMobLimit(mobid, 1, 0, 206, 1)
                }
                cm.dispose()
            }
        }
    }
};